<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'Product.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link type="text/css" rel="stylesheet"
	href="/EasyBuy/statics/css/style.css" />

<script type="text/javascript"
	src="/EasyBuy/statics/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="/EasyBuy/statics/js/menu.js"></script>

<script type="text/javascript" src="/EasyBuy/statics/js/lrscroll_1.js"></script>


<script type="text/javascript" src="/EasyBuy/statics/js/n_nav.js"></script>

<link rel="stylesheet" type="text/css"
	href="/EasyBuy/statics/css/ShopShow.css" />
<link rel="stylesheet" type="text/css"
	href="/EasyBuy/statics/css/MagicZoom.css" />
<script type="text/javascript" src="/EasyBuy/statics/js/MagicZoom.js"></script>

<script type="text/javascript" src="/EasyBuy/statics/js/num.js">
    	var jq = jQuery.noConflict();
    </script>

<script type="text/javascript" src="/EasyBuy/statics/js/p_tab.js"></script>

<script type="text/javascript" src="/EasyBuy/statics/js/shade.js"></script>

</head>

<body>
<c:if test="${list1==null }">
	<%
		request.getRequestDispatcher("/IndexServlet?opr=type&hre=Product").forward(request, response);
	 %>
</c:if>
	<!-- 头部 -->

	<%@ include file="../../common/header.jsp"%>
	<%@ include file="../../common/preHeader.jsp"%>
	<!--Begin Header Begin-->

	<!--End Menu End-->
	<div class="i_bg">
		<div class="postion">
			<span class="fl">全部 > 美妆个护 > 香水 > 迪奥 > 迪奥真我香水</span>
		</div>
		<div class="content">

			<div id="tsShopContainer" title="${productDetil.id }">
				<div id="tsImgS">
					<a href="/EasyBuy/statics/images/${productDetil.fileName }" title="Images"
						class="MagicZoom" id="MagicZoom"><img
						src="/EasyBuy/statics/images/${productDetil.fileName }" width="390" height="390" />
					</a>
				</div>
				<div id="tsPicContainer">
					<div id="tsImgSArrL" onclick="tsScrollArrLeft()"></div>
					<div id="tsImgSCon" style="width:395px;">
						<ul>
							<li onclick="showPic(0)" rel="MagicZoom"><img
								src="/EasyBuy/statics/images/${productDetil.fileName }"
								tsImgS="/EasyBuy/statics/images/${productDetil.fileName }" width="79" height="79" />
							</li>
							<li onclick="showPic(1)" rel="MagicZoom"><img
								src="/EasyBuy/statics/images/${details.imgone }"
								tsImgS="/EasyBuy/statics/images/${details.imgone }" width="79" height="79" />
							</li>
							<li onclick="showPic(2)" rel="MagicZoom"><img
								src="/EasyBuy/statics/images/${details.imgtwo }"
								tsImgS="/EasyBuy/statics/images/${details.imgtwo }" width="79" height="79" />
							</li>
							<li onclick="showPic(3)" rel="MagicZoom"><img
								src="/EasyBuy/statics/images/${details.imgthree }"
								tsImgS="/EasyBuy/statics/images/${details.imgthree }" width="79" height="79" />
							</li>
							<li onclick="showPic(4)" rel="MagicZoom"><img
								src="/EasyBuy/statics/images/${productDetil.fileName }"
								tsImgS="/EasyBuy/statics/images/${productDetil.fileName }" width="79" height="79" />
							</li>
							<li onclick="showPic(5)" rel="MagicZoom"><img
								src="/EasyBuy/statics/images/${details.imgone }"
								tsImgS="/EasyBuy/statics/images/${details.imgone }" width="79" height="79" />
							</li>
							<li onclick="showPic(6)" rel="MagicZoom"><img
								src="/EasyBuy/statics/images/${details.imgtwo }"
								tsImgS="/EasyBuy/statics/images/${details.imgtwo }" width="79" height="79" />
							</li>
							<li onclick="showPic(7)" rel="MagicZoom"><img
								src="/EasyBuy/statics/images/${details.imgthree }"
								tsImgS="/EasyBuy/statics/images/${details.imgthree }" width="79" height="79" />
							</li>
						</ul>
					</div>
					<div id="tsImgSArrR" onclick="tsScrollArrRight()"></div>
				</div>
				<img class="MagicZoomLoading" width="16" height="16"
					src="/EasyBuy/statics/images/loading.gif" alt="Loading..." />
			</div>

			<div class="pro_des">
				<div class="des_name">
					<p>${productDetil.name }</p>
					${productDetil.description }
				</div>
				<div class="des_price">
					本店价格：<b>￥${productDetil.price }</b><br /> 消费积分：<span>${productDetil.integral }R</span>
				</div>
				<div class="des_choice">
					<span class="fl">型号选择：</span>
					<ul>
						<li class="checked">30ml
							<div class="ch_img"></div>
						</li>
						<li>50ml
							<div class="ch_img"></div>
						</li>
						<li>100ml
							<div class="ch_img"></div>
						</li>
					</ul>
				</div>
				<div class="des_choice">
					<span class="fl">颜色选择：</span>
					<ul>
						<li>红色
							<div class="ch_img"></div>
						</li>
						<li class="checked">白色
							<div class="ch_img"></div>
						</li>
						<li>黑色
							<div class="ch_img"></div>
						</li>
					</ul>
				</div>
				<div class="des_share">
					<div class="d_sh">
						分享
						<div class="d_sh_bg">
							<a href="#"><img src="/EasyBuy/statics/images/sh_1.gif" />
							</a> <a href="#"><img src="/EasyBuy/statics/images/sh_2.gif" />
							</a> <a href="#"><img src="/EasyBuy/statics/images/sh_3.gif" />
							</a> <a href="#"><img src="/EasyBuy/statics/images/sh_4.gif" />
							</a> <a href="#"><img src="/EasyBuy/statics/images/sh_5.gif" />
							</a>
						</div>
					</div>
					<div class="d_care">
						<a onclick="ShowDiv('MyDiv','fade')" id="shouCang" title="${productDetil.id }">关注商品</a>
					</div>
				</div>
				<div class="des_join">
					<div class="j_nums">
						<input type="text" value="1" name="" class="n_ipt" /> <input
							type="button" value="" onclick="addUpdate(jq(this));" id="jiajia"
							class="n_btn_1" /> <input type="button" value=""
							onclick="jianUpdate(jq(this));" class="n_btn_2" id="jianjian"/>
					</div>
					<span class="fl"><a onclick="ShowDiv_1('MyDiv1','fade1')"><img id="tj"
							src="/EasyBuy/statics/images/j_car.png" title="${productDetil.id }"/>
					</a>
					</span>
				</div>
			</div>

			<div class="s_brand">
				<div class="s_brand_img">
					<img src="/EasyBuy/statics/images/${productDetil.brand_url }" width="188"
						height="132" />
				</div>
				<div class="s_brand_c">
					<a href="/EasyBuy/pre/product/Brand.jsp">进入品牌专区</a>
				</div>
			</div>


		</div>
		<div class="content mar_20">
		
			<div class="l_history">
				<div class="fav_t">用户还喜欢</div>
				<!-- 引用浏览历史页面  -->
				<%@ include file="../../common/CategorySide.jsp"%>
			</div>		
			<div class="l_list">
				<div class="des_border">
					<div class="des_tit">
						<ul>
							<li class="current">推荐搭配</li>
						</ul>
					</div>
					<div class="team_list">
						<div class="img">
							<a href="ConmmodityDetailsServlet?opr=productDetils&id=${productDetil.id }"><img src="/EasyBuy/statics/images/mat_1.jpg"
								width="160" height="140" />
							</a>
						</div>
						<div class="name">
							<a href="ConmmodityDetailsServlet?opr=productDetils&id=${productDetil.id }">倩碧补水组合套装8折促销</a>
						</div>
						<div class="price">
							<div class="checkbox">
								<input type="checkbox" name="zuhe" checked="checked" />
							</div>
							<font>￥<span>768.00</span>
							</font> &nbsp; 18R
						</div>
					</div>
					<div class="team_icon">
						<img src="/EasyBuy/statics/images/jia_b.gif" />
					</div>
					<div class="team_list">
						<div class="img">
							<a href="ConmmodityDetailsServlet?opr=productDetils&id=${productDetil.id }"><img src="/EasyBuy/statics/images/mat_2.jpg"
								width="160" height="140" />
							</a>
						</div>
						<div class="name">
							<a href="ConmmodityDetailsServlet?opr=productDetils&id=${productDetil.id }">香奈儿邂逅清新淡香水50ml</a>
						</div>
						<div class="price">
							<div class="checkbox">
								<input type="checkbox" name="zuhe" />
							</div>
							<font>￥<span>749.00</span>
							</font> &nbsp; 18R
						</div>
					</div>
					<div class="team_icon">
						<img src="/EasyBuy/statics/images/jia_b.gif" />
					</div>
					<div class="team_list">
						<div class="img">
							<a href="ConmmodityDetailsServlet?opr=productDetils&id=${productDetil.id }"><img src="/EasyBuy/statics/images/mat_3.jpg"
								width="160" height="140" />
							</a>
						</div>
						<div class="name">
							<a href="ConmmodityDetailsServlet?opr=productDetils&id=${productDetil.id }">香奈儿邂逅清新淡香水50ml</a>
						</div>
						<div class="price">
							<div class="checkbox">
								<input type="checkbox" name="zuhe" checked="checked" />
							</div>
							<font>￥<span>749.00</span>
							</font> &nbsp; 18R
						</div>
					</div>
					<div class="team_icon">
						<img src="/EasyBuy/statics/images/equl.gif" />
					</div>
					<div class="team_sum">
						套餐价：￥<span>1517</span><br /> <input type="text" value="1"
							class="sum_ipt" /><br /> <a><img
							src="/EasyBuy/statics/images/z_buy.gif" />
						</a>
					</div>

				</div>
				<div class="des_border">
					<div class="des_tit">
						<ul>
							<li class="current" id="current"><a>商品属性</a>
							</li>
							<li id="details"><a>商品详情</a>
							</li>
							<li id="comment"><a>商品评论</a>
							</li>
						</ul>
					</div>
					<div class="des_border" id="p_attribute" style="margin-top: 10">
						<div class="des_t">商品属性</div>
						<div class="des_con">
						
						<table border="0" align="center"
							style="width:100%; font-family:'宋体'; margin:10px auto;"
							cellspacing="0" cellpadding="0">
							<tr>
								<td>商品名称：${productDetil.name }</td>
								<td>商品编号：${productDetil.id }</td>
								<td>品牌： ${productDetil.brand_name }</td>
								<td>上架时间：${details.date }</td>
							</tr>
							<tr>
								<td>商品毛重：160.00g</td>
								<td>商品产地：${details.place }</td>
								<td>香调：果香调香型：淡香水/香露EDT</td>
								<td>&nbsp;</td>
							</tr>
							<tr>
								<td>容量：1ml-15ml</td>
								<td>类型：女士香水，Q版香水，组合套装</td>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
							</tr>
						</table>


					</div>
					</div>
					
				</div>

				<div class="des_border" id="p_details">
					<div class="des_t">商品详情</div>
					<div class="des_con">
						<table border="0" align="center"
							style="width:745px; font-size:14px; font-family:'宋体';"
							cellspacing="0" cellpadding="0">
							<tr>
								<td width="265"><img src="/EasyBuy/statics/images/${productDetil.fileName }"
									width="206" height="412" />
								</td>
								<td><b>${productDetil.name }</b><br /> 【商品规格】：${details.specifications }<br /> 【商品质地】：${details.texture }<br />
									【商品日期】：${details.date }<br /> 【商品产地】：${details.place }<br /> 【商品包装】：${details.packing }<br />
									 【适用人群】：${details.people }<br /></td>
							</tr>
						</table>

						<p align="center">
							<img src="/EasyBuy/statics/images/${details.imgdetail }" width="746"
								height="1700" /><br />
							
						</p>

					</div>
				</div>

				<div class="des_border" id="p_comment">
					<div class="des_t">商品评论</div>

					<table border="0" class="jud_tab" cellspacing="0" cellpadding="0">
						<tr>
							<td width="175" class="jud_per">
								<p><fmt:formatNumber value='${ haoPing/zong*100}' type='currency' pattern='0.00'/>%</p>好评度</td>
							<td width="300">
								<table border="0" style="width:100%;" cellspacing="0"
									cellpadding="0">
									<tr>
										<td width="90">好评<font color="#999999">（
<fmt:formatNumber value='${ haoPing/zong*100}' type='currency' pattern='0.00'/> %）</font>
										</td>
										<td><img src="/EasyBuy/statics/images/pl.gif"
											align="absmiddle" />
										</td>
									</tr>
									<tr>
										<td>中评<font color="#999999">（
										<fmt:formatNumber value='${zhongPing/zong*100 }' type='currency' pattern='0.00'/>%）</font>
										</td>
										<td><img src="/EasyBuy/statics/images/pl.gif"
											align="absmiddle" />
										</td>
									</tr>
									<tr>
										<td>差评<font color="#999999">（<fmt:formatNumber value='${chaPing/zong*100 }' type='currency' pattern='0.00'/>%）</font>
										</td>
										<td><img src="/EasyBuy/statics/images/pl.gif"
											align="absmiddle" />
										</td>
									</tr>
								</table></td>
							<td width="185" class="jud_bg">
								购买过${productDetil.name }的顾客，在收到商品才可以对该商品发表评论</td>
							<td class="jud_bg"><span id="tiShiGou"></span><br />
							<a class="pingLun"><img src="/EasyBuy/statics/images/btn_jud.gif" />
							</a>
							</td>
						</tr>
					</table>
					<table border="0" class="jud_list"
						style="width:100%; margin-top:30px;" cellspacing="0"
						cellpadding="0">
						<c:choose>
							<c:when test="${comments=='[]' }">
								<tr valign="top"><td><font color="#999999">暂无评论！</font></td></tr>
							</c:when>
							<c:otherwise>
								<c:forEach items="${comments }" var="comment">
									<tr valign="top">
										<td width="160"><img src="/EasyBuy/statics/images/${comment.comment_url }"
											width="20" height="20" align="absmiddle" />&nbsp;${comment.comment_author}
										</td>
										<td width="180">颜色分类：<font color="#999999">粉色</font> <br />
											型号：<font color="#999999">50ml</font>
										</td>
										<td>${comment.comment_content }。<br /> <font color="#999999">${comment.comment_date }</font>
										</td>
									</tr>
								</c:forEach>
							</c:otherwise>
						</c:choose>
					</table>
					<div class="pages">
						<a class="p_pre">上一页</a><a class="cur">1</a><a
							class="p_pre">下一页</a>
					</div>

				</div>


			</div>
		</div>


		<!--Begin 弹出层-收藏成功 Begin-->
		<div id="fade" class="black_overlay"></div>
		<div id="MyDiv" class="white_content">
			<div class="white_d">
				<div class="notice_t">
					<span class="fr" style="margin-top:10px; cursor:pointer;"
						onclick="CloseDiv('MyDiv','fade')"><img id="chaHao1"
						src="/EasyBuy/statics/images/close.gif" />
					</span>
				</div>
				<div class="notice_c">

					<table border="0" align="center" style="margin-top:;"
						cellspacing="0" cellpadding="0">
						<tr valign="top">
							<td width="40"><img src="/EasyBuy/statics/images/suc.png" />
							</td>
							<td><span
								style="color:#3e3e3e; font-size:18px; font-weight:bold;" id="neiRong"></span><br />
								<a href="/EasyBuy/backend/order/Member_Collect.jsp">查看我的关注 >></a></td>
						</tr>
						<tr height="50" valign="bottom">
							<td>&nbsp;</td>
							<td><a class="b_sure">确定</a>
							</td>
						</tr>
					</table>

				</div>
			</div>
		</div>
		<!--End 弹出层-收藏成功 End-->


		<!--Begin 弹出层-加入购物车 Begin-->
		<div id="fade1" class="black_overlay"></div>
		<div id="MyDiv1" class="white_content">
			<div class="white_d">
				<div class="notice_t">
					<span class="fr" style="margin-top:10px; cursor:pointer;"
						onclick="CloseDiv_1('MyDiv1','fade1')"><img id="chaHao"
						src="/EasyBuy/statics/images/close.gif" />
					</span>
				</div>
				<div class="notice_c">

					<table border="0" align="center" style="margin-top:;"
						cellspacing="0" cellpadding="0">
						<tr valign="top">
							<td width="40"><img src="/EasyBuy/statics/images/suc.png" />
							</td>
							<td id="neiRong"><span
								style="color:#3e3e3e; font-size:18px; font-weight:bold;">宝贝已成功添加到购物车</span><br />
								购物车共有<span id="jiZhong"></span>种宝贝（<span id="jiJian"></span>件） &nbsp; &nbsp; 合计：<span id="zongJia"></span>元</td>
						</tr>
						<tr height="50" valign="bottom">
							<td>&nbsp;</td>
							<td><a href="/EasyBuy/pre/settlement/BuyCar.jsp" class="b_sure">去购物车结算</a><a href="ConmmodityListServlet?opr=categoryList&id=548"
								class="b_buy">继续购物</a>
							</td>
						</tr>
					</table>

				</div>
			</div>
		</div>
		<!--End 弹出层-加入购物车 End-->
		<!--End 猜你喜欢 End-->
		<%@ include file="../../common/footer.jsp"%>
		<!-- 脚部 -->
	</div>
</body>
<script type="text/javascript"
		src="/EasyBuy/statics/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
		function hideType(){
			$(".leftNav").hide();
		}
		hideType();
		$("#jiajia").click(function(){
			var p = $(this).prev().val();
			var q = $(this);
			var productId=$("#tsShopContainer").attr("title");
			$.get("/EasyBuy/BuyCarServlet","opr=stock&productId="+productId,function(data){
							if(data == parseFloat(p)){
								q.attr("disabled","disabled");
							}
						});
		});
		$("#jianjian").click(function(){
			if($(this).next().next().attr("disabled")){
							$(this).next().next().removeAttr("disabled");
						}
		});
		function selectAll(){
			var productId=$("#tsShopContainer").attr("title");
			$.getJSON("CommentServlet","opr=commentsProductId&productId="+productId,callAll);
			function callAll(datas){
				$(".jud_list").html("");
				if(datas.length==0){
					$(".jud_list").append("<tr valign='top'><td><font color='#999999'>暂无评论！</font></td></tr>");
				}else{
					for ( var i = 0; i < datas.length; i++) {
					$(".jud_list").append("<tr valign='top'>"+
										"<td width='160'><img src='/EasyBuy/statics/images/"+datas[i].comment_url+"'"+
											"width='20' height='20' align='absmiddle' />&nbsp;"+datas[i].comment_author+
										"</td>"+
										"<td width='180'>颜色分类：<font color='#999999'>粉色</font> <br />"+
											"型号：<font color='#999999'>50ml</font>"+
										"</td>"+
										"<td>"+datas[i].comment_content+"。<br /> <font color='#999999'>"+datas[i].comment_date+"</font>"+
										"</td>"+
									"</tr>");
				}
				}	
			}
		}
		$("#p_details,#p_comment").hide();
		$("#current").click(function(){
			$(this).addClass("current");
			$("#details,#comment").removeClass("current");
			$("#p_attribute").show();
			$("#p_details,#p_comment").hide();
		});
		$("#details").click(function(){
			$(this).addClass("current");
			$("#current,#comment").removeClass("current");
			$("#p_details").show();
			$("#p_attribute,#p_comment").hide();
		});
		$("#comment").click(function(){
			selectAll();
			$(this).addClass("current");
			$("#details,#current").removeClass("current");
			$("#p_comment").show();
			$("#p_details,#p_attribute").hide();
			var userId=$(".user").attr("title");
			var productId=$("#tsShopContainer").attr("title");
			$.getJSON("CommentServlet","opr=commentPanDuan&userId="+userId,callBackPan);
			function callBackPan(dataPan){
				if(dataPan.length==0){
					$("#tiShiGou").text("您还没有购买该商品，不能评论");
					$(".pingLung").css("disabled","true");
				}else{
					for ( var i = 0; i < dataPan.length; i++) {
						if(productId==dataPan[i].productId){
							$(".pingLung").css("disabled","false");
							$("#tiShiGou").text("您可对已购买商品进行评价");
							$(".pingLun").click(function(){
								$(".jud_list").html("");
								$(".jud_list").append("<tr valign='top'><td>"+
								"评价内容:<input class='contents' type='text' /></td></tr>"+
								"<tr valign='top'><td><input type='radio' class='haoPing'>好评<input type='radio' class='zhongPing'>中评<input type='radio' class='chaPing'>差评</td></tr>"+
								"<tr valign='top'><td>"+
								"<input type='button' class='fa' value='发表'/></td></tr>");
								$(".fa").click(function(){
								var praise=0;
								if($(".haoPing").attr("checked")==true){
									praise=1;
								}else if($(".zhongPing").attr("checked")==true){
									praise=2;
								}else if($(".chaPing").attr("checked")==true){
									praise=3;
								}else{
									praise=0;
								}
								var content=$(".contents").val();
								var productId=$("#tsShopContainer").attr("title"); 
								var userName=$(".user").text();
								$.getJSON("CommentServlet","opr=addComment&content="+content+"&productId="+productId+"&userName="+userName+"&praise="+praise,callBack);
								function callBack(data){
									if(data==1){
										alert("发表成功！");
										//selectAll();
										window.location.reload();//刷新当前页面. 
									}else{
										alert("发表失败！");
										selectAll();
									}
								}
								});
					});
						}
					}
				}
			}
		});
		
		$("#tsImgSCon>ul>li:eq(0)").addClass("tsSelectImg");
		$("#tsImgSCon>ul>li").mouseenter(function(){
			$("#tsImgSCon>ul>li:eq(0)").removeClass("tsSelectImg");
			$(this).addClass("tsSelectImg");
		});
		$("#tsImgSCon>ul>li").mouseleave(function(){
			$(this).removeClass("tsSelectImg");
		});
		$("#shouCang").click(function(){
			var productId=$(this).attr("title");
			var userId=$(".user").attr("title");
			$.getJSON("/EasyBuy/CollectServlet","opr=categoryShou&productId="+productId+"&userId="+userId,callBackShou);
			function callBackShou(dataShou){
				if(dataShou=="have"){
					$("#neiRong").text("已加入收藏");
					document.getElementById("MyDiv").style.display='block';
					document.getElementById("fade").style.display='block' ;
					var bgdiv = document.getElementById("fade");
					bgdiv.style.width = document.body.scrollWidth;
					// bgdiv.style.height = $(document).height();
					$("#fade").height($(document).height());
				}else if(dataShou=="success"){
					$("#neiRong").text("加入收藏成功");
					document.getElementById("MyDiv").style.display='block';
					document.getElementById("fade").style.display='block' ;
					var bgdiv = document.getElementById("fade");
					bgdiv.style.width = document.body.scrollWidth;
					// bgdiv.style.height = $(document).height();
					$("#fade").height($(document).height());
				}else if(dataShou=="error"){
					$("#neiRong").text("加入收藏失败");
					document.getElementById("MyDiv").style.display='block';
					document.getElementById("fade").style.display='block' ;
					var bgdiv = document.getElementById("fade");
					bgdiv.style.width = document.body.scrollWidth;
					// bgdiv.style.height = $(document).height();
					$("#fade").height($(document).height());
				}
			}
		});
		$("#chaHao1,.b_sure").click(function(){
			document.getElementById("MyDiv").style.display='none';
			document.getElementById("fade").style.display='none';
		});
		$("#tj").click(function(){
			alert("${applicationScope.id}");		//孙玮泽
			var productId=$("#tj").attr("title");
			var userId=$(".user").attr("title");
			var productNum=$(".n_ipt").val();
			add();
			function add(){
				$.get("BuyCarServlet","opr=addBuyCar&uId="+userId+"&pId="+productId+"&pNum="+productNum,function(data){
					if(data == "cg"){
						//alert("添加成功");
						$.getJSON("BuyCarServlet","opr=addBuyCarSuccess&userId="+userId,function(dataC){
							$("#jiZhong").text(dataC.meiJian);
							$("#jiJian").text(dataC.zongJian);
							$("#zongJia").text(dataC.zongJia);
							document.getElementById("MyDiv1").style.display='block';
						document.getElementById("fade1").style.display='block' ;
						var bgdiv = document.getElementById("fade1");
						alert(bgdiv);
						bgdiv.style.width = document.body.scrollWidth;
						// bgdiv.style.height = $(document).height();
						$("#"+bg_div).height($(document).height());
						});
					}else if(data=="sb"){
						//alert("添加失败");
						$("#neiRong").html("<span>加入购物车失败</span>");
						document.getElementById("MyDiv1").style.display='block';
						document.getElementById("fade1").style.display='block' ;
						var bgdiv = document.getElementById("fade1");
						alert(bgdiv);
						bgdiv.style.width = document.body.scrollWidth;
						// bgdiv.style.height = $(document).height();
						$("#"+bg_div).height($(document).height());
					}
				});
			}
		});
		$("#chaHao").click(function(){
			document.getElementById("MyDiv1").style.display='none';
			document.getElementById("fade1").style.display='none';
		});
	});
</script>
</html>
